<?php

namespace App\Http\Controllers;

use App\Http\Requests\AlbumArticleAdd;
use App\Models\AlbumArticle;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class AlbumArticleController extends BaseController
{
    public function add(AlbumArticleAdd $request)
    {
        $aa = new AlbumArticle();
        $aa->user_id = $this->userId;
        $aa->album_id = $request->input('album_id');
        $aa->group_id = $request->input('group_id');
        $aa->images = $request->input('images');
        $aa->content = $request->input('content');

        DB::beginTransaction();
        if ($aa->save()) {
            if ($this->contentPP()) {
                DB::commit();
                return $this->jsonResultOk();
            }
        }

        DB::rollBack();
        return $this->jsonResultFail();
    }


}
